package com.example.ws.handler.elsearch;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.example.ws.GlobalConfLoader;
import com.example.ws.util.Container;

import lombok.extern.slf4j.Slf4j;


public class ElSearchService {
    
    private ElSearchClient client = Container.INSTANCE.getObjectByClass(ElSearchClient.class);

    public String info() {
        return "elasticsearch-test-info-page";
    }

    public Map<String, List<Map<String, Object>>> findAll() {
        try {
            return client.searchAllIndicesDocuments();
        } catch (IOException e) {
            e.printStackTrace();
            return new HashMap<>();
        }
    }

    public void insert() {
        
    }

}